package com.example.houduan.Mapper;

import com.example.houduan.Pojo.Doctor;
import com.example.houduan.Pojo.Drug;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DrugMapper {
    List<Drug> selectDrugLimit(int b ,int e);
    List<Drug> selectDrugByConditions(Integer drug_id,String drug_name,String company_name);

    @Select("select count(*) from drug inner join huiyi.drugcompany d on drug.company_id = d.company_id")
    int selectDrugCount();
    @Delete("delete from drug where drug_id=#{drug_id}")
    int deleteDrug(int drug_id);

    @Insert("insert into drug values (#{drug_id},#{drug_name},#{drug_info},#{drug_effect},#{drug_img},#{createtime},#{updatetime},#{publisher},#{drugCompany.company_id})")
    int insertDrug(Drug drug);

    @Update("update drug set drug_name=#{drug_name},drug_info=#{drug_info},drug_effect=#{drug_effect},updatetime=#{updatetime},publisher=#{publisher},company_id=#{drugCompany.company_id},drug_img=#{drug_img} where drug_id=#{drug_id}")
    int updateDrug(Drug drug);
}
